package com.zhanglijie.improve.atomic.three;

import java.util.concurrent.atomic.AtomicMarkableReference;

import com.zhanglijie.base.sync.mardwordDetail.FatLockTest;

/**
 * @author zhanglijie
 * @version 1.0
 * @since 1.1.0 2022/9/10 0010 19:05
 */
public class AtomicMarkerRefenceTest {
    public static void main(String[] args) {
        AtomicMarkableReference<String> refence = new AtomicMarkableReference<>(new String("zhangsan"), false);
        System.out.println("init value="+refence.getReference()+" mark ="+refence.isMarked());

        String origin = refence.getReference();
        boolean marked = refence.isMarked();
        System.out.println("第一次修改");
        System.out.println(refence.compareAndSet(origin,new String("new string"),marked,true));
        System.out.println("updated value="+refence.getReference()+" mark ="+refence.isMarked());
    }
}
